package cn.gson.springboot.model.pojos;

import javax.persistence.*;
import java.sql.Date;
import java.util.Objects;

@Entity
@Table(name = "action_", schema = "crm")
public class Action {
    private int actionId;
    private String actionDescribe;
    private Integer actionClassify;
    private Date actionFinishDate;
    private String actionCustomerName;
    private String actionContactName;
    private String actionEmpName;
    private Opportunity opportunityByOppId;
    private Maintenance maintenanceByMaiId;

    @Id
    @Column(name = "action_id", nullable = false)
    public int getActionId() {
        return actionId;
    }

    public void setActionId(int actionId) {
        this.actionId = actionId;
    }



    @Basic
    @Column(name = "action_describe", nullable = true, length = 255)
    public String getActionDescribe() {
        return actionDescribe;
    }

    public void setActionDescribe(String actionDescribe) {
        this.actionDescribe = actionDescribe;
    }

    @Basic
    @Column(name = "action_classify", nullable = true)
    public Integer getActionClassify() {
        return actionClassify;
    }

    public void setActionClassify(Integer actionClassify) {
        this.actionClassify = actionClassify;
    }

    @Basic
    @Column(name = "action_finish_date", nullable = true)
    public Date getActionFinishDate() {
        return actionFinishDate;
    }

    public void setActionFinishDate(Date actionFinishDate) {
        this.actionFinishDate = actionFinishDate;
    }

    @Basic
    @Column(name = "action_customer_name", nullable = true, length = 255)
    public String getActionCustomerName() {
        return actionCustomerName;
    }

    public void setActionCustomerName(String actionCustomerName) {
        this.actionCustomerName = actionCustomerName;
    }

    @Basic
    @Column(name = "action_contact_name", nullable = true, length = 255)
    public String getActionContactName() {
        return actionContactName;
    }

    public void setActionContactName(String actionContactName) {
        this.actionContactName = actionContactName;
    }

    @Basic
    @Column(name = "action_emp_name", nullable = true, length = 255)
    public String getActionEmpName() {
        return actionEmpName;
    }

    public void setActionEmpName(String actionEmpName) {
        this.actionEmpName = actionEmpName;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        Action action = (Action) o;
        return actionId == action.actionId &&
                Objects.equals(actionDescribe, action.actionDescribe) &&
                Objects.equals(actionClassify, action.actionClassify) &&
                Objects.equals(actionFinishDate, action.actionFinishDate) &&
                Objects.equals(actionCustomerName, action.actionCustomerName) &&
                Objects.equals(actionContactName, action.actionContactName) &&
                Objects.equals(actionEmpName, action.actionEmpName);
    }

    @Override
    public int hashCode() {
        return Objects.hash(actionId, actionDescribe, actionClassify, actionFinishDate, actionCustomerName, actionContactName, actionEmpName);
    }

    @ManyToOne
    @JoinColumn(name = "opp_id", referencedColumnName = "opp_id")
    public Opportunity getOpportunityByOppId() {
        return opportunityByOppId;
    }

    public void setOpportunityByOppId(Opportunity opportunityByOppId) {
        this.opportunityByOppId = opportunityByOppId;
    }

    @ManyToOne
    @JoinColumn(name = "mai_id", referencedColumnName = "mai_id")
    public Maintenance getMaintenanceByMaiId() {
        return maintenanceByMaiId;
    }

    public void setMaintenanceByMaiId(Maintenance maintenanceByMaiId) {
        this.maintenanceByMaiId = maintenanceByMaiId;
    }
}
